<?php

namespace App\Http\Middleware;

use Closure;

class LoginMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
		//登录权限验证
		//检测session中是否有登录信息
		if($request->session()->has('isAdmin') && $request->session()->has('uid') && $request->session()->has('uname') ){
			return $next($request);
		}else{
			//返回登录界面
			return redirect('/admin/login');
		}
    }
}
